def num_partitions_from(dataset_size, reduction_factor=20, max_partitions=4000):
    import math
    root_n = math.ceil(math.sqrt(dataset_size / reduction_factor))
    num_partitions = max(1, min(max_partitions, root_n))
    return num_partitions